package com.xj.dao;


import com.xj.entity.Record;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

public interface RecordDao extends JpaRepository<Record, Integer> {
    @Modifying
    @Transactional
    @Query
   int  deleteAllByFilename(String  filename);

    @Query(value = "exec(:sql)  ",nativeQuery = true)
    List<Map<String,Object>>   executeSql(@Param("sql") String  sql);


    @Query(value = "SELECT  column_name  AS fieldname FROM INFORMATION_SCHEMA.COLUMNS  WHERE TABLE_NAME = :tablename",nativeQuery = true)
    List<String>  getTableColumn(String tablename);

}
